OpenCities Map CONNECT Edition Help

System.String

Method

Description

Method syntax

Examples

Compare

Compares two strings.

Returns:

True if stringA equals stringB

False otherwise

Boolean System.String.Compare (String stringA, String stringB)

System.String.Compare ("COMPUTERNAME", "ABC123")

CompareI

Compares two strings.

Comparison is case-insensitive.

Returns:

True if stringA equals stringB

False otherwise

Boolean System.String.CompareI (String stringA, String stringB)

System.String.CompareI ("COMPUTERNAME", "abc123")

IndexOf

Returns the index of the first occurrence of the specified token in the string.

Returns -1 if token is not found.

If string is empty, returns 0.

Int System.String.IndexOf (String inputString, String token)

System.String.IndexOf ("Government - Local", "Government")

Use color 8 if value of Type property contains the string "Government":



LastIndexOf

Returns the index of the last occurrence of the specified token in the string.

Returns -1 if token is not found.

If string is empty, returns 0.

Int System.String.LastIndexOf (String inputString, String token)

System.String.LastIndexOf ("Government - Local", "Government")

Length

Gets the number of characters in the input string.

Int System.String.Length (String inputString)

System.String.Length("My string")

Substring

Retrieves a substring from an input string.

startIndex is a zero-based starting character position of the substring in the input string.

If input length is -1 then substring from startIndex to end of string is returned.

String System.String.Substring (String inputString, Int startIndex, Int length)

System.String.Substring ("My string",1,-1)

ToLower

Returns a copy of the input string converted to lower case.

String System.String.ToLower (String inputString)

System.String.ToLower("ABC")

ToUpper

Returns a copy of the input string converted to upper case.

String System.String.ToUpper (String inputString)

System.String.ToUpper("abc")

Trim

Removes all leading and trailing white-space characters from the input string.

See for list of white-space characters.

String System.String.Trim (String inputString)

System.String.Trim(" trim leading and trailing space ")